// 天气相关的API请求
const BASE_URL = 'http://127.0.0.1:8080/api'

export const weatherApi = {
  async getWeatherData(city) {
    try {
      const response = await fetch(`${BASE_URL}/weather/last7days?city=${city}`)
      return await response.json()
    } catch (error) {
      console.error('获取天气数据失败:', error)
      throw error
    }
  },

  async getWeatherStats(city) {
    try {
      const response = await fetch(`${BASE_URL}/weather/stats/forecast?city=${city}`)
      return await response.json()
    } catch (error) {
      console.error('获取天气统计数据失败:', error)
      throw error
    }
  }
} 